#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)
#define epr(i, x, y) for(int i = h[x], y = e[i].v; i; i = e[i].nxt, y = e[i].v)

using namespace std;

using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 3e5 + 10;
const int M = N << 1;

int n, m, Q, t, rt, sum[N], fa[N], val[N];
vec G[N];

namespace ori { 
	int h[N], low[N], dfn[N], tim, stk[N], top, scc, bel[N], cnt, deg[N];
	bool v[N]; vec tG[N];
	struct edge { int v, nxt; } e[M];
	void link(int x, int y) { e[++cnt] = (edge) { y, h[x] }; h[x] = cnt; }
	
	void tarjan(int x) {
		low[x] = dfn[x] = ++tim; v[x] = true; stk[++top] = x;
		epr(i, x, y)
			if(!dfn[y]) tarjan(y), chkmin(low[x], low[y]);
			else if(v[y]) chkmin(low[x], dfn[y]);
		if(low[x] == dfn[x]) {
			++scc; int y; 
			do {
				v[y = stk[top--]] = false; bel[y] = scc; ++val[scc];
			} while(y ^ x);
		}
	}

	void solve() {
		n = in, m = in, Q = in, t = in;
		while(m--) { int u = in, v = in; link(u, v); }
		rep(i, 1, n) if(!dfn[i]) tarjan(i);
		rep(x, 1, n) epr(i, x, y) if(bel[x] ^ bel[y]) tG[bel[x]].eb(bel[y]), deg[bel[y]]++;
		queue < int > q; rep(i, 1, scc) if(deg[i] == 0) q.ep(rt = i);
		while(q.size()) {
			int x = q.front(); q.pop();
			for(auto y : tG[x]) if(--deg[y] == 0) G[x].eb(y), q.ep(y);
		} 
	}
}

int tim, dfn[N], dep[N], pw[21], lg[N << 1], mn[21][N << 1];

int tmn(int x, int y) { return dep[x] < dep[y] ? x : y; }

void init() {
	pw[0] = 1; rep(i, 1, 19) pw[i] = pw[i - 1] << 1; rep(i, 2, tim) lg[i] = lg[i >> 1] + 1;
	rep(i, 1, 19) rep(x, 1, tim - pw[i] + 1) mn[i][x] = tmn(mn[i - 1][x], mn[i - 1][x + pw[i - 1]]);
	cerr << mn[18][1] << endl;
}

void dfs(int x) { mn[0][dfn[x] = ++tim] = x; for(auto y : G[x]) fa[y] = x, sum[y] = sum[x] + val[y], dep[y] = dep[x] + 1, dfs(y), mn[0][++tim] = x; }

int lca(int x, int y) { x = dfn[x]; y = dfn[y]; if(x > y) swap(x, y); int k = lg[y - x + 1]; return tmn(mn[k][x], mn[k][y - pw[k] + 1]); }

int pot[N << 1], stk[N], top, tot, S, T, ltot;
veg tG[N], rG[N];
bool sv[N], tv[N];

void link(int x, int y, int w) { /*cerr << "L : " << x << " " << y << endl,*/ tG[x].eb(y, w); rG[y].eb(x, w); }

queue < int > q;

void solve() {
	S = ori :: bel[in], T = ori :: bel[in]; tot = top = 0; pot[++tot] = S; pot[++tot] = T;
	//cerr << "Q : " << S<<  " " << T << endl;
	rep(i, 1, t) { int x = ori :: bel[in], y = ori :: bel[in]; if(x == y) continue; pot[++tot] = x, pot[++tot] = y; link(x, y, 0); }
	sort(pot + 1, pot + tot + 1, [](int a, int b) { return dfn[a] < dfn[b]; });
	ltot = tot = unique(pot + 1, pot + tot + 1) - pot - 1; stk[top = 1] = pot[1];
	rep(i, 2, ltot) {
		int x = pot[i], L = lca(x, stk[top]); 
		while(top > 1 && dep[L] <= dep[stk[top - 1]])
			link(stk[top - 1], stk[top], sum[fa[stk[top]]] - sum[stk[top - 1]]), pot[++tot] = stk[top], top--;
		if(L ^ stk[top]) link(L, stk[top], sum[fa[stk[top]]] - sum[L]), pot[++tot] = stk[top], stk[top] = L;
		stk[++top] = x;
	} rep(i, 1, top - 1) link(stk[i], stk[i + 1], sum[fa[stk[i + 1]]] - sum[stk[i]]);
	rep(i, 1, top) pot[++tot] = stk[i];
	q.ep(S); sv[S] = true;
	while(q.size()) {
		int x = q.front(); q.pop(); 
		for(auto v : tG[x]) if(!sv[v.fi]) q.ep(v.fi), sv[v.fi] = true;
	}
	q.ep(T); tv[T] = true; int ans = 0;
	while(q.size()) {
		int x = q.front(); q.pop(); if(sv[x]) ans += val[x]; else continue;
		for(auto v : rG[x]) {
			if(sv[x] && sv[v.fi]) ans += v.se;
			if(!tv[v.fi]) tv[v.fi] = true, q.ep(v.fi);
		}
	} printf("%d\n", ans);
	rep(i, 1, tot) sv[pot[i]] = tv[pot[i]] = 0, tG[pot[i]].clear(), rG[pot[i]].clear();
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("celebration.in", "r", stdin); freopen("celebration.out", "w", stdout);
#endif
	ori :: solve(); n = ori :: scc; dep[rt] = 1; dfs(rt); init();
	while(Q--) solve();
	return 0;
}
